
#pragma once

#include "ql.h"

#include <limits.h> // for UINT_MAX, CHAR_BIT

#define QL_CHUNK_NUM_BITS   (sizeof(unsigned int) * CHAR_BIT)

typedef struct ListChunk
{
    unsigned int    free_mask;
    List            arr[QL_CHUNK_NUM_BITS];
} ListChunk;

typedef struct ListBlock
{
    struct ListBlock * next;
    
    /*
     * heuristic parameter:
     * determines nearest free chunk's index in this block
     */
    size_t          nfc_index;

    ListChunk       chunks[1];
} ListBlock;

typedef struct ListsStorage
{
    ListBlock *     blk;
} ListsStorage;
